package com.xiaoxin.experience.service.ssh.model;

import com.xiaoxin.experience.util.FileUtil;
import lombok.Getter;
import lombok.Setter;

import java.io.File;
import java.io.Serializable;

/**
 * @author xiaoxin
 */
@Setter
@Getter
public class FileInfo implements Serializable
{
    private static final long serialVersionUID = -4086730613706592299L;

    private String fileName;

    private String filePath;

    private String fileSize;

    private String remoteDir;

    private String updateTime;

    public FileInfo()
    {
    }

    public FileInfo(File file)
    {
        this.fileName = file.getName();
        this.filePath = file.getAbsolutePath();
        this.fileSize = FileUtil.getHumanFileSize(file.length());
        this.remoteDir = "/home/" + file.getName().substring(0,file.getName().lastIndexOf(".")) + "/app/";
        this.updateTime = FileUtil.getFileLastModified(file);
    }
}
